﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProgrammingIsMyPassion.Coding.Test
{
    [TestClass]
    public class SearchStringinTextProblemTest
    {
        [TestMethod]
        public void Find1Test()
        {
            //Arrange
            SearchStringinTextProblem engine = new SearchStringinTextProblem();
            engine.Search = "approved";
            //Act
            int expected = engine.Find1(engine.Text, engine.Search);
            //Assert
            Assert.IsTrue(expected > -1);
        }
        //Find2_BoyerMoore
        [TestMethod]
        public void Find2_BoyerMooreTest()
        {
            //Arrange
            SearchStringinTextProblem engine = new SearchStringinTextProblem();
            engine.Search = "free";
            engine.Text = "bree" +  engine.Text;
            //Act
            int expected = engine.Find2_BoyerMoore(engine.Text, engine.Search);
            //Assert
            Assert.IsTrue(expected > -1);
        }
        [TestMethod]
        public void Find2_BoyerMoore_bigword_Test()
        {
            //Arrange
            SearchStringinTextProblem engine = new SearchStringinTextProblem();
            engine.Search = "approved";
            engine.Text = "maproved" + engine.Text;
            //Act
            int expected = engine.Find2_BoyerMoore(engine.Text, engine.Search);
            //Assert
            Assert.IsTrue(expected > -1);
        }

        //QuickTextSearch
        [TestMethod]
        public void QuickTextSearch_bigword_Test()
        {
            //Arrange
            SearchStringinTextProblem engine = new SearchStringinTextProblem();
            engine.Search = "approved";
            engine.Text = "bree" + engine.Text;
            //Act
            int expected = engine.QuickTextSearch(engine.Text, engine.Search);
            //Assert
            Assert.IsTrue(expected > -1);
        }
    }
}
